package com.atomos.strategy.initialize.life
{
	import com.atomos.particle.Particle;
	import com.atomos.strategy.initialize.InitializeStrategy;
	import com.atomos.utils.RandomUtils;

	public class LifeInitializer implements InitializeStrategy
	{
		protected var _nLife : Number;
		protected var _nRandom : Number;
		
		public function LifeInitializer ( life : uint, rand : Number = 0 )
		{
			_nLife = isNaN( life ) ? 1 : life;
			_nRandom = isNaN( rand ) ? 0 : rand;
		}
		
		public function initialize( particle : Particle ) : void
		{
			particle.maxLife = _nLife + RandomUtils.ibalance( _nRandom );
		}
	}
}